<?php

$html = '<div class="bookProfile"><h2>Добавяне на автори</h2></div>';
$html .= '<div>
    <form method="POST">
        <div>
            Автор: <input type="text" name="author" />
            <input type="submit" value="Добави"/>
        </div>
    </form>
</div>';

if ($data['errors'] > 0) {
    foreach ($data['errors'] as $error) {
        $html .= '<p class="error">' . $error . '</p>';
    }
}

$html .= '<div><table><thead><tr><th>Автори</th></tr></thead><tbody>';
$oddEven = 'odd';
foreach ($data['authors'] as $author) {
    if ($oddEven == 'odd') {
        $oddEven = 'even';
    } else {
        $oddEven = 'odd';
    }
    $html .= '<tr class="' . $oddEven . '"><td><a href="index.php?p=author&author_id=' . $author['id'] . '">'
            . htmlspecialchars($author['name']) . '</a></td></tr>';
}
$html .= '</tbody></table></div>';

echo $html;